package
{
	import org.robotlegs.mvcs.Mediator;
	
	public class MessageViewMediator extends Mediator
	{
		public function MessageViewMediator()
		{
			super();
		}
		[Inject]
		public var view:MessageView;
		
/*		The onRegister() method is the hook provided to you when the mediator 
		has been fully initialized. The injections have occurred, the view is 
		ready, and it is where you typically add your event listeners for both 
		the view component and the application. You will typically override this 
		method in every Robotlegs mediator you create.*/
		override public function onRegister():void
		{
			trace("I am registered");
			addContextListener(HelloWorldMessageEvent.MESSAGE_DISPATCHED,handleMessage);
		}
		public function handleMessage(e:HelloWorldMessageEvent):void
		{
			view.text = e.message;
		}
	}
}